<?php

namespace app\validate;

use share\validate\SceneValidate;

class UserDeviceBindingValidate extends SceneValidate{

    protected $rule = [
        'state' => 'require|min:16',
        'encode' => 'require|min:30',
        'userId' => 'require|min:30',
        'token' => 'require|min:30',
        'userIdentity' => 'require|min:10',
        'serverSite' => 'require|min:1|max:10',
        'info' => 'require|array|min:1|max:512',
        'deviceName' => 'require|min:10|max:120',
        'productKey' => 'require|min:10|max:120',
        'queryTime' => 'require|number|>=:1',
        'iotId' => 'require|min:10|max:64',
        'chNum' => 'require|number|>=:0|<=:512',
        'deviceType' => 'require|number',
    ];    

    public $sceneRules = [
        'list' => [
            'userId' => 'length:2,60',
            'iotId' => 'length:2,60',
        ],
    ];

    protected $scene = [
        'bind' => ['userId','token','userIdentity','serverSite','info','state','encode'],
        'delete' => ['userId','token','info','state','encode'],
        'changeBindInfo' => ['userId','token','info','state','encode'],
        'getUser' => ['userId','token','deviceName','state','encode'],
        'getUserV2' => ['userId','token','deviceName','productKey','queryTime','state','encode'],
        'isBind' => ['deviceName','productKey','queryTime','state','encode'],
        'isBindSimple' => ['deviceName','state','encode'],
        'infoDetail' => ['deviceName','iotId','chNum'],
        'unbind' => ['deviceName','productKey','deviceType'],
        'list' => ['iotId','userId'],
    ];
}